<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>部门列表</title>
<link rel="stylesheet" type="text/css" href="css/site.css">
</head>
<body>
<jsp:include page="header.jsp"></jsp:include>
<jsp:include page="menu.jsp"></jsp:include>
<div class="container">
	
	<h1>部门列表</h1>
	<form action="dept.do?action=search" method="post">
		关键字：<input type="text" name="key">
		<input type="submit" value="搜索">
	</form>
	<table border="1" width="100%">
		<tr>
			<th>ID</th>
			<th>部门名</th>
			<th>办公室</th>
			<th>电话</th>
			<th>操作</th>		
		</tr>
		
		<!-- 解析数据并且显示出来 -->
		<c:if test="${requestScope.depts==null }">
			<!-- 请求转发 -->
			<jsp:forward page="dept.do?action=getAll"></jsp:forward>
		</c:if>
		
		<c:forEach items="${requestScope.depts }" var="dept">
			<tr>
				<td>${dept.did }</td>
				<td>${dept.dname }</td>
				<td>${dept.droom }</td>
				<td>${dept.dphone }</td>
				<td>
					<a href="">修改</a>
					<a href="dept.do?action=remove">删除</a>
				</td>	
			</tr>
		</c:forEach>
		
	</table>	
</div>
</body>
</html>